const { PureComponent } = require("react");

class Child extends PureComponent {
  render() {
    return (
      <div>
        子组件
      </div>
    )
  }
}

class DemoA extends PureComponent {
  fn() {
    console.log(this.refs.chi);
  }
  render() {
    return (
      <div>
        <h1>类组件</h1>
        {/* ref写到组件上，目的是为了获取组件实例 */}
        <Child ref="chi"></Child>
        <button onClick={() => this.fn()}>点我</button>
      </div>
    )
  }
}

export default DemoA;